package abstractEntities;

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import entities.Team;
import entities.User;
import entitiesIds.UserteamId;

/**
 * AbstractUserteam entity provides the base persistence definition of the
 * Userteam entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractUserteam implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -8045733809094394589L;
	private UserteamId id;
	private User user;
	private Team team;
	private Date admittanceDate;
	private Date requestDate;

	// Constructors

	/** default constructor */
	public AbstractUserteam() {
	}

	/** minimal constructor */
	public AbstractUserteam(UserteamId id, User user, Team team,
			Date requestDate) {
		this.id = id;
		this.user = user;
		this.team = team;
		this.requestDate = requestDate;
	}

	/** full constructor */
	public AbstractUserteam(UserteamId id, User user, Team team,
			Date admittanceDate, Date requestDate) {
		this.id = id;
		this.user = user;
		this.team = team;
		this.admittanceDate = admittanceDate;
		this.requestDate = requestDate;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idTeam", column = @Column(name = "idTeam", nullable = false)),
			@AttributeOverride(name = "idUser", column = @Column(name = "idUser", nullable = false)) })
	public UserteamId getId() {
		return this.id;
	}

	public void setId(UserteamId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idUser", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idTeam", nullable = false, insertable = false, updatable = false)
	public Team getTeam() {
		return this.team;
	}

	public void setTeam(Team team) {
		this.team = team;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "admittanceDate", length = 10)
	public Date getAdmittanceDate() {
		return this.admittanceDate;
	}

	public void setAdmittanceDate(Date admittanceDate) {
		this.admittanceDate = admittanceDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "requestDate", nullable = false, length = 10)
	public Date getRequestDate() {
		return this.requestDate;
	}

	public void setRequestDate(Date requestDate) {
		this.requestDate = requestDate;
	}

}